package org.zachary.agent.domain.aggregate_model.user;

import jakarta.persistence.Embeddable;

import java.util.Objects;

@Embeddable
public class Gender {
    private String gender;
    public Gender() {}
    public Gender(String gender) {
        System.out.println(gender);
        if(gender.equals("男") || gender.equals("女")){
            this.gender = gender;
        }else{
            throw new IllegalArgumentException("Gender cannot be null or empty");
        }
    }
    public String getValue() {
        return gender;
    }
    public String toString() {
        return gender;
    }
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Gender g = (Gender) o;
        return Objects.equals(gender,g.gender);
    }
    public int hashCode() {
        return Objects.hash(gender);
    }

}
